//动态路由的配置
//没登录时，只能访问login 其他页面不需要渲染
//在用户登录之后，根据后台返回当前用户菜单信息，对比信息，计算出用户的路由配置

const dynamicRoutes = [
  {
    path: "/",
    component: () => import(/**webpackChunkName:"home" */ "../pages/Home"),
    //路由元信息
    redirect: "/welcome",
    // 所有用户都能访问到这个充值中心和充值管理
    children: [
      {
        //一级菜单
        path: "vipmanager",
        component: () =>
          import(/*webpackChunkName:"vipmanager" */ "../pages/Home/VipManager"),
        name: "VipManager", //具名路由
        meta: {
          //储存一些自定义属性
          fullPath: "/vipmanager",
          icon: "iconfont icon-vip", //可以自定义
          name: "VIP管理", //这个属性很重要,作用是用于和后台菜单数据进行对比
        },
        children: [
          {
            path: "charge",
            component: () =>
              import(
                /*webpackChunkName:"charge" */ "../pages/Home/VipManager/Charge"
              ),
            name: "Charge", //具名路由
            meta: {
              //储存一些自定义属性
              fullPath: "/vipmanager/charge",
              icon: "iconfont icon-chongzhi", //可以自定义
              name: "VIP充值", //这个属性很重要,作用是用于和后台菜单数据进行对比
            },
          },
          {
            path: "order",
            component: () =>
              import(
                /*webpackChunkName:"order" */ "../pages/Home/VipManager/Order"
              ),
            name: "Order", //具名路由
            meta: {
              //储存一些自定义属性
              fullPath: "/vipmanager/order",
              icon: "iconfont icon-vipgunali", //可以自定义
              name: "订单管理", //这个属性很重要,作用是用于和后台菜单数据进行对比
            },
          },
        ],
      },
      {
        path:"pre_order",
        component:()=>import(/*webpackChunkName:"pre_order"*/"../pages/Home/PreOrder"),
        name:"pre_order",
        meta:{
          name:"预支付"
        }
      }
    ],
  },
  {
    path: "*",
    component: () => import(/**webpackChunkName:"page404"*/ "../pages/Page404"),
  },
];

export default dynamicRoutes;
